import React, { Component } from "react";
import { withRouter, Link } from "react-router-dom";
import {observer} from 'mobx-react';
import { Tools } from 'weaver-mobile';

const getLabel = Tools.getLabel;

@withRouter
@observer
export default class LocationInfo extends Component {
    render(){
        const {store} = this.props;
        const {hasLocationInfo, currentPosition: locationInfo, outSignSetting, locationsLayoutStore} = store;
        const {address} = locationInfo;

        return (
            <div className='info'>
                <div className='range'>
                    <div>{getLabel('126403','我的位置')}</div>
                    {
                        hasLocationInfo && outSignSetting.nearly == '1' &&
                        <div>
                            <Link to={locationsLayoutStore.path}>
                            {getLabel('504543','附近位置')}
                            </Link>
                        </div>    
                    }
                </div>
                {
                    hasLocationInfo && 
                    <div className='position'>{address || ''}</div>
                }
            </div>
        )
    }
}